package com.chapter6.jiekou.demo4;

import com.chapter6.jiekou.demo1.Animal;
import com.chapter6.jiekou.demo1.Cat;
import com.chapter6.jiekou.demo1.Dog;
import com.chapter6.jiekou.demo3.Bird;
import com.chapter6.jiekou.demo3.Flyable;


/**
 * 在驯兽师（Trainer）的训练方法（train）中，让动物实现各自的方法
 */
public class Zoo2 {
    public static void main(String[] args) {
        Animal[] animals ={new Dog(),new Cat(),new Bird()};
        Trainer tr;
        for (Animal an:animals){
            tr=new Trainer(an);
            tr.train();
        }

    }
}
